<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
		<link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title>燕府</title>
    <style>
      .hide{
        opacity: 0;
        display:none;
      }
      .show{
        opacity: 1;
      }
    </style>
	</head>
	<body>
		<noscript>
			<strong>We're sorry but zycy doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
		</noscript>
		<div id="app"></div>
		<!-- built files will be auto injected -->
	</body>
	<script type="text/javascript">
		;(function(designWidth, maxWidth) {
      var doc = document,
              win = window,
              docEl = doc.documentElement,
              remStyle = document.createElement("style"),
              tid,
              winHeight = document.body.clientHeight || document.documentElement.clientHeight;
      
      win.onresize = function(){
        let oFooter = document.querySelector('footer');
        if(document.body.clientHeight < winHeight) {
          oFooter && (oFooter.classList.add('hide'))
        } else {
          oFooter && (oFooter.classList.remove('hide'))
        }
      }
      
      function refreshRem() {
        var width = docEl.getBoundingClientRect().width;
        maxWidth = maxWidth || 540;
        width>maxWidth && (width=maxWidth);
        var rem = width * 10 / designWidth;
        remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
      }

      if (docEl.firstElementChild) {
        docEl.firstElementChild.appendChild(remStyle);
      } else {
        var wrap = doc.createElement("div");
        wrap.appendChild(remStyle);
        doc.write(wrap.innerHTML);
        wrap = null;
      }
      //要等 wiewport 设置好后才能执行 refreshRem，不然 refreshRem 会执行2次；
      refreshRem();

      win.addEventListener("resize", function() {
        clearTimeout(tid); //防止执行两次
        tid = setTimeout(refreshRem, 300);
      }, false);

      win.addEventListener("pageshow", function(e) {
        if (e.persisted) { // 浏览器后退的时候重新计算
          clearTimeout(tid);
          tid = setTimeout(refreshRem, 300);
        }
      }, false);

      if (doc.readyState === "complete") {
        doc.body.style.fontSize = "10px";
      } else {
        doc.addEventListener("DOMContentLoaded", function(e) {
          doc.body.style.fontSize = "10px";
        }, false);
      }
    })(375, 750);
	</script>
</html>
